package com.letian.record.service.impl;

import java.util.List;

import com.letian.common.annotation.DataScope;
import com.letian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.letian.record.mapper.RecordCountMapper;
import com.letian.record.domain.RecordCount;
import com.letian.record.service.IRecordCountService;

/**
 * 记录数量Service业务层处理
 * 
 * @author bmz
 * @date 2023-01-15
 */
@Service
public class RecordCountServiceImpl implements IRecordCountService 
{
    @Autowired
    private RecordCountMapper recordCountMapper;

    /**
     * 查询记录数量
     * 
     * @param countId 记录数量主键
     * @return 记录数量
     */
    @Override
    public RecordCount selectRecordCountByCountId(Long countId)
    {
        return recordCountMapper.selectRecordCountByCountId(countId);
    }

    /**
     * 查询记录数量列表
     * 
     * @param recordCount 记录数量
     * @return 记录数量
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "record_count")
    public List<RecordCount> selectRecordCountList(RecordCount recordCount)
    {
        return recordCountMapper.selectRecordCountList(recordCount);
    }

    /**
     * 查询记录数量列表
     *
     * @param recordCount 记录数量
     * @return 记录数量
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "record_count")
    public List<RecordCount> selectRecordCountListToday(RecordCount recordCount)
    {
        return recordCountMapper.selectRecordCountListToday(recordCount);
    }

    /**
     * 新增记录数量
     * 
     * @param recordCount 记录数量
     * @return 结果
     */
    @Override
    public int insertRecordCount(RecordCount recordCount)
    {
        recordCount.setCreateTime(DateUtils.getNowDate());
        return recordCountMapper.insertRecordCount(recordCount);
    }

    /**
     * 修改记录数量
     * 
     * @param recordCount 记录数量
     * @return 结果
     */
    @Override
    public int updateRecordCount(RecordCount recordCount)
    {
        recordCount.setUpdateTime(DateUtils.getNowDate());
        return recordCountMapper.updateRecordCount(recordCount);
    }

    /**
     * 批量删除记录数量
     * 
     * @param countIds 需要删除的记录数量主键
     * @return 结果
     */
    @Override
    public int deleteRecordCountByCountIds(Long[] countIds)
    {
        return recordCountMapper.deleteRecordCountByCountIds(countIds);
    }

    /**
     * 删除记录数量信息
     * 
     * @param countId 记录数量主键
     * @return 结果
     */
    @Override
    public int deleteRecordCountByCountId(Long countId)
    {
        return recordCountMapper.deleteRecordCountByCountId(countId);
    }
}
